/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package statusy;

import bazy.HibernateUtil;
import bazy.Statusy;
import bazy.Zamowienia;
import org.hibernate.Session;

/**
 *
 * @author Jan Słowik
 */
public class KontrolerStatusow {

    public KontrolerStatusow(Integer id_zamow, int status) {
        Session session = HibernateUtil.getSessionFactory().openSession();
        org.hibernate.Transaction tx = session.beginTransaction();
        Statusy pom_stat = (Statusy) session.load(Statusy.class, status);
        Zamowienia zam = (Zamowienia) session.load(Zamowienia.class, id_zamow);
        zam.setStatusy(pom_stat);
        session.update(zam);
        tx.commit();
        session.close();
    }
}
